<?php
/**
 * Application Routes
 * Every page or function in the entire application is listed in this routes file. The Zend Framework comes with some default routes which would allow you
 * to simply request 'product/edit' and get the edit action in the product controller. I have disabled the default routes. The reason I do this is so that
 * each function in the app has a name. Giving each function its own name allows me to completely decouple the url structure from the application. If I want
 * to change anything about the directory structure in the application, it can be done in this one file. Nifty, eh?
 * @todo Look into doing this with an ini file, does it allow a smaller file? I imagine it takes quite a bit longer than reading a php array. The way I have
 * 		 it is probably the best.
 */
return array(

	/**
	 * Default Module
	 */
	/* --------------------------------------------------------------------------------------------------------------------------------------------------- */
	/**
	 * Index Controller
	 */
	'home' => new Zend_Controller_Router_Route_Static('', array('controller' => 'index', 'action' => 'index')),
	/**
	 * Auth Controller
	 */
	'auth_login' => new Zend_Controller_Router_Route_Static('login', array('controller' => 'auth', 'action' => 'login')),
	'auth_logout' => new Zend_Controller_Router_Route_Static('logout', array('controller' => 'auth', 'action' => 'logout')),
	'auth_register' => new Zend_Controller_Router_Route_Static('register', array('controller' => 'auth', 'action' => 'register')),
	/**
	 * Products Controller
	 */
	'product_category' => new Zend_Controller_Router_Route('products/:slug/:page', array('controller' => 'product', 'action' => 'category', 'page' => 1), array('slug' => '[a-zA-Z0-9_-]+', 'page' => '\d+')),
	'product_detail' => new Zend_Controller_Router_Route('product/:slug', array('controller' => 'product', 'action' => 'detail'), array('slug' => '[a-zA-Z0-9_-]+')),
	'product_addtocart' => new Zend_Controller_Router_Route('product/:slug', array('controller' => 'product', 'action' => 'detail'), array('slug' => '[a-zA-Z0-9_-]+')),
	
	/**
	 * Admin Module
	 * @todo This should be in the admin route (admin/routes.php). Each extension will have its own routes.php as well
	 */
	/* --------------------------------------------------------------------------------------------------------------------------------------------------- */
	/**
	 * Index Controller
	 */
	'admin_dashboard' => new Zend_Controller_Router_Route_Static('admin', array('module' => 'admin', 'controller' => 'index', 'action' => 'index')),
	/**
	 * Auth Controller
	 */
	'admin_auth_login' => new Zend_Controller_Router_Route_Static('admin/login', array('module' => 'admin', 'controller' => 'auth', 'action' => 'login')),
	'admin_auth_logout' => new Zend_Controller_Router_Route_Static('admin/logout', array('module' => 'admin', 'controller' => 'auth', 'action' => 'logout')),
	/**
	 * Category Controller
	 */
	'admin_category_list' => new Zend_Controller_Router_Route('admin/categories/:page', array('module' => 'admin', 'controller' => 'category', 'action' => 'list', 'page' => 1), array('page' => "\d+")),
	'admin_category_add' => new Zend_Controller_Router_Route_Static('admin/category/add', array('module' => 'admin', 'controller' => 'category', 'action' => 'add')),
	'admin_category_edit' => new Zend_Controller_Router_Route('admin/category/edit/:category_id/:tab', array('module' => 'admin', 'controller' => 'category', 'action' => 'edit', 'tab' => 'default'), array('category_id' => '\d+', 'tab' => '[a-zA-Z0-9_-]+')),
	'admin_category_delete' => new Zend_Controller_Router_Route('admin/category/delete/:category_id', array('module' => 'admin', 'controller' => 'category', 'action' => 'delete'), array('category_id' => '\d+')),
	'admin_category_activate' => new Zend_Controller_Router_Route('admin/category/activate/:category_id', array('module' => 'admin', 'controller' => 'category', 'action' => 'activate'), array('category_id' => '\d+')),
	'admin_category_deactivate' => new Zend_Controller_Router_Route('admin/category/deactivate/:category_id', array('module' => 'admin', 'controller' => 'category', 'action' => 'deactivate'), array('category_id' => '\d+')),
	'admin_category_setorder' => new Zend_Controller_Router_Route('admin/category/setorder/:category_id', array('module' => 'admin', 'controller' => 'category', 'action' => 'setorder'), array('category_id' => '\d+')),
	'admin_category_reorder' => new Zend_Controller_Router_Route_Static('admin/category/reorder', array('module' => 'admin', 'controller' => 'category', 'action' => 'reorder')),
	/**
	 * Product Controller
	 */
	'admin_product_list' => new Zend_Controller_Router_Route('admin/products/:page', array('module' => 'admin', 'controller' => 'product', 'action' => 'list', 'page' => 1), array('page' => "\d+")),
	'admin_product_add' => new Zend_Controller_Router_Route_Static('admin/product/add', array('module' => 'admin', 'controller' => 'product', 'action' => 'add')),
	'admin_product_edit' => new Zend_Controller_Router_Route('admin/product/edit/:product_id/:tab', array('module' => 'admin', 'controller' => 'product', 'action' => 'edit', 'tab' => 'default'), array('product_id' => '\d+', 'tab' => '[a-zA-Z0-9_-]+')),
	'admin_product_delete' => new Zend_Controller_Router_Route('admin/product/delete/:product_id', array('module' => 'admin', 'controller' => 'product', 'action' => 'delete'), array('product_id' => '\d+')),
	/**
	 * Customer Controller
	 */
	'admin_customer_list' => new Zend_Controller_Router_Route('admin/customers/:page', array('module' => 'admin', 'controller' => 'customer', 'action' => 'list', 'page' => 1), array('page' => '\d+')),
	'admin_customer_add' => new Zend_Controller_Router_Route_Static('admin/customer/add', array('module' => 'admin', 'controller' => 'customer', 'action' => 'add')),
	'admin_customer_edit' => new Zend_Controller_Router_Route('admin/customer/edit/:customer_id/:tab', array('module' => 'admin', 'controller' => 'customer', 'action' => 'edit', 'tab' => 'default'), array('customer_id' => '\d+', 'tab' => '[a-zA-Z0-9_-]+')),
	'admin_customer_delete' => new Zend_Controller_Router_Route('admin/customer/delete/:customer_id', array('module' => 'admin', 'controller' => 'customer', 'action' => 'delete'), array('customer_id' => '\d+')),

);